<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../libs/vue.js"></script>
    <style>
        /* 进入之前/离开之后 */
        .str-enter,.str-leave-to {
            opacity: 0;
            left: 300px;
            transform: scale(1.5);
        }

        /* 进入之后/离开之前 */
        .str-enter-to,.str-leave {
            opacity: 1;
            left: 0;
            transform: scale(1);
        }

        /* 进入状态/离开状态 */
        .str-enter-active,.str-leave-active {
            transition: 1s;
            position: relative;
        }

        /* 进入之前/离开之后 */
        .msg-enter,.msg-leave-to {
            opacity: 0;
            left: 300px;
            transform: rotate(360deg);
        }

        /* 进入之后/离开之前 */
        .msg-enter-to,.msg-leave {
            opacity: 1;
            left: 0;
            transform: rotate(0deg);
        }

        /* 进入状态/离开状态 */
        .msg-enter-active,.msg-leave-active {
            transition: 1s;
            position: relative;
        }
        .box {
            width: 300px;
        }
        .box1 {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div id="app">
        <button @click="toggle">点击切换</button>
        <hr>
        <!-- 
            name 过渡自定义类名
            appear 让元素以动画方式入场
         -->
        <transition name="msg" appear>
            <h1 v-show="flag" class="box">{{msg}}</h1>
        </transition>

        <transition name="str" appear>
            <h3 v-show="flag" class="box1">6666666</h3>
        </transition>
        

    </div>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                msg: 'hello vue',
                flag: true
            },
            methods: {
                toggle() {
                    this.flag = !this.flag
                }
            },
        })
    </script>
</body>

</html>